PATH![]() |
![]() ![]() |
Throws an exception to a specified task.
OSStatus MPThrowException (
MPTaskID task,
MPExceptionKind kind);
The exception is treated in the same manner as any other exception taken by a task. However, since it is asynchronous, it may not be presented immediately.
By convention, you should set the exception kind to kMPTaskStoppedErr if you want to suspend a task. In general, you should do so only if you are debugging and wish to examine the state of the task. Otherwise you should block the task using one of the traditional notification mechanisms (such as a message queue).
An exception can be thrown at any time, whether that task is running, eligible to be run (that is, ready), or blocked. The task is suspended and an exception message may be generated the next time the task is about to run. Note that this may never occur-- for example, if the task is deadlocked or the resource it is waiting on is never released. If the task is currently blocked when this function is executed, kMPTaskBlockedErr is returned. If the task was suspended immediately at the conclusion of this function call the return value is kMPTaskStoppedErr .